import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/postParameter")
public class PostParameterServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 获取 POST 请求中 body 的内容
        // body 格式的处理:  aa=10&bb=20   (form表单)
        String aa = req.getParameter("aa");
        String bb = req.getParameter("bb");

        // 将内容打印到服务器控制台
        System.out.println("aa:" + aa);
        System.out.println("bb:" + bb);
        resp.getWriter().write("ok");
    }
}
